<template>
  <div class="app-container">
    <el-table
      v-loading="listLoading"
      :data="list"
      element-loading-text="Loading"
      border
      fit
      highlight-current-row
    >
      <el-table-column align="center" label="ID" width="95">
        <template slot-scope="scope">
          {{ scope.$index }}
        </template>
      </el-table-column>
      <el-table-column label="流程名称">
        <template slot-scope="scope">
          {{ scope.row.NodeName }}
        </template>
      </el-table-column>
      <el-table-column label="流程ID" width="320" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.Processid }}</span>
        </template>
      </el-table-column>
      <el-table-column label="版本" width="100" align="center">
        <template slot-scope="scope">
          {{ scope.row.WF_Version }}
        </template>
      </el-table-column>
      <el-table-column label="创建时间" width="200" align="center">
        <template slot-scope="scope">
          <i class="el-icon-time" />
          <span>{{ scope.row.WF_DocCreated }}</span>
        </template>
      </el-table-column>
      <el-table-column label="修改时间" width="200" align="center">
        <template slot-scope="scope">
          <i class="el-icon-time" />
          <span>{{ scope.row.WF_LastModified }}</span>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="120" align="center">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="handleClick(scope.row)">打开</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>

import { getProcessMsg } from '@/api/approver'

export default {
  // filters: {
  //   statusFilter(status) {
  //     const statusMap = {
  //       published: 'success',
  //       draft: 'gray',
  //       deleted: 'danger'
  //     }
  //     return statusMap[status]
  //   }
  // },
  data() {
    return {
      list: null,
      listLoading: true
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      this.listLoading = true
      getProcessMsg('').then(response => {
        this.list = response.data
        this.listLoading = false
      })
    },
    handleClick(row) {
      const routeUrl = this.$globalExtUrl.globalExtUrl.openNewProcessUrl(row.Processid)
      window.open(routeUrl)
    }
  }
}

</script>

<style lang="scss" scoped>

</style>
